package handler

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/slrun/callcenter/configs"
	"github.com/slrun/callcenter/internal/service"
)

// Handler API处理器结构体
type Handler struct {
	Config          *configs.Config
	Services        *service.Services
	TicketHandler   *TicketHandler
	MonitorHandler  *MonitorHandler
	SystemHandler   *SystemHandler
}

// NewHandler 创建新的处理器实例
func NewHandler(cfg *configs.Config, svcs *service.Services) *Handler {
	h := &Handler{
		Config:   cfg,
		Services: svcs,
	}
	
	// 初始化各处理器
	h.TicketHandler = NewTicketHandler(svcs)
	h.MonitorHandler = NewMonitorHandler(svcs)
	h.SystemHandler = NewSystemHandler(svcs)
	
	return h
}

// HealthCheck 健康检查
func (h *Handler) HealthCheck(c *gin.Context) {
	c.JSON(http.StatusOK, gin.H{
		"status": "ok",
		"message": "Call Center API is running",
	})
}